package com.twu.biblioteca;

import com.google.common.base.Objects;

import static com.google.common.base.Objects.equal;

public class User {
    private String username;
    private String email;
    private String password;
    private String phone;

    public String getUsername() {
        return username;
    }

    public User username(String username) {
        this.username = username;
        return this;
    }

    public String getEmail() {
        return email;
    }

    public User email(String email) {
        this.email = email;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public User password(String password) {
        this.password = password;
        return this;
    }

    public String getPhone() {
        return phone;
    }

    public User phone(String phone) {
        this.phone = phone;
        return this;
    }

    @Override
    public String toString() {
        return "Your information: {" +
                "username='" + username + '\'' +
                ", email='" + email + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof User)) return false;
        User user = (User) o;
        return equal(this.username, user.username);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(username);
    }
}
